package collections;

import compare.Student;

import javax.swing.text.Style;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * @Author Klys
 * @Date 2023/6/2
 * @Description
 * @Version 1.0
 */
public class CollectionsDemo {

    public static void main(String[] args) {

        Student student1 = new Student(19, "aaa");
        Student student2 = new Student(13, "ccc");
        Student student3 = new Student(89, "bbb");
//        List<Student> studentList = Arrays.asList(student1, student2,student3);
        ArrayList<Student> studentList = new ArrayList<>();
        studentList.add(student1);
        studentList.add(student2);
        studentList.add(student3);
        System.out.println("排序前：");
        studentList.forEach(System.out::println);
        Collections.sort(studentList);
        System.out.println("排序后：");
        studentList.forEach(System.out::println);
    }
}
